<template>
	<view class="tabbar-container">
		<block>
			<view class="tabbar-item" v-for="(item, index) in tabbarList"
				:class="[item.centerItem ? ' center-item' : '']" @click="changeItem(item)" >
				<view class="item-top">
					<image :src="currentItem == item.id ? item.selectIcon : item.icon"></image>
				</view>
				<view class="item-bottom" :class="[currentItem == item.id ? 'item-active' : '']">
					<text :class="item.text==='发布'?'aaaa':''">{{ item.text }}</text>
				</view>
			</view>
		</block>
	</view>
</template>

<script>
	export default {
		props: {
			currentPage: {
				type: Number,
				default: 0
			}
		},
		data() {
			return {
				currentItem: 0,
				tabbarList: [{
						id: 0,
						path: '/pages/home/home',
						icon: 'http://124.222.72.174:8008/images/底下功能区-Lfare/首页-未选中.png',
						selectIcon: 'http://124.222.72.174:8008/images/底下功能区-Lfare/首页.png',
						text: '首页',
						centerItem: false
					},
					{
						id: 1,
						path: '/pages/release/release',
						icon: 'http://124.222.72.174:8008/images/底下功能区-Lfare/发布.png',
						selectIcon: 'http://124.222.72.174:8008/images/底下功能区-Lfare/发布.png',
						text: '发布',
						centerItem: true
					},
					{
						id: 2,
						path: '/pages/my/my',
						icon: 'http://124.222.72.174:8008/images/底下功能区-Lfare/个人中心-未选中.png',
						selectIcon: 'http://124.222.72.174:8008/images/底下功能区-Lfare/个人中心.png',
						text: '个人中心',
						centerItem: false
					},
				]
			};
		},
		onLoad() {
			console.log("xx"+this.currentItem)
		},
		mounted() {
			this.currentItem = this.currentPage;
			uni.hideTabBar();
		},
		methods: {
			changeItem(item) {
				let _this = this;
				uni.switchTab({
					url: item.path,

				});
			},
		}
	};
</script>
<style>
	view {
		padding: 0;
		margin: 0;
		box-sizing: border-box;
	}

	.tabbar-container {
		position: fixed;
		bottom: 0;
		left: 0;
		width: 100%;
		height: 130rpx;
		box-shadow: 0 0 5px #999;
		display: flex;
		align-items: center;
		padding: 5rpx 0;
		color: #999999;
		background-color: #FFFFFF;
	}

	.tabbar-container .tabbar-item {
		width: 33.33%;
		height: 100rpx;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		text-align: center;
		margin-bottom: 20px;
	}

	.tabbar-container .item-active {
		color: #f00;
	}

	.tabbar-container .center-item {
		display: block;
		position: relative;
	}

	.tabbar-container .tabbar-item .item-top {
		width: 70rpx;
		height: 70rpx;
		padding: 10rpx;
	}

	.tabbar-container .center-item .item-top {
		flex-shrink: 0;
		width: 120rpx;
		height: 120rpx;
		position: absolute;
		top: -60rpx;
		left: calc(50% - 60rpx);
		border-radius: 50%;
		box-shadow: 0 0 5px #999;
		background-color: #ffffff;
	}

	.tabbar-container .tabbar-item .item-top image {
		width: 100%;
		height: 100%;
	}

	.tabbar-container .tabbar-item .item-bottom {
		font-size: 28rpx;
		width: 100%;
	}

	.tabbar-container .center-item .item-bottom {
		position: absolute;
		bottom: 5rpx;
		padding-bottom: 8px;
	}

	.aaaa {
		position: absolute;
		left: 98rpx;
		top: -14rpx;
	}
</style>
